//
//  WJQNetwork.m
//  TripTogether
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 王军岐. All rights reserved.
//

#import "WJQNetwork.h"

@implementation WJQNetwork

+ (void)getAFNet:(NSString *)url block:(getAFNetBlock)block errorBlock:(Error)errorBlock
{
    
    
    
    NSString *url_string = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    
    
    AFHTTPSessionManager* manager = [AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    
    [manager GET:url_string parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        block(responseObject);
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
        errorBlock(error);
    }];

}
@end
